home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DLight.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  9.8 KB  |  342 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DLight.h                                                  **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Generic light routines                                      **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1991-1997 Apple Computer, Inc. All rights reserved.     **    
  11.  **                                                                          **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DLight_h
  15. #define QD3DLight_h
  16.  
  17. #include "QD3D.h"
  18.  
  19. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  20.     #pragma once
  21. #endif  /*  PRAGMA_ONCE  */
  22.  
  23. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  24.  
  25. #if defined(__xlc__) || defined(__XLC121__)
  26.     #pragma options enum=int
  27.     #pragma options align=power
  28. #elif defined(__MWERKS__)
  29.     #pragma enumsalwaysint on
  30.     #pragma options align=native
  31. #elif defined(__MRC__) || defined(__SC__)
  32.     #if __option(pack_enums)
  33.         #define PRAGMA_ENUM_RESET_QD3DLIGHT 1
  34.     #endif
  35.     #pragma options(!pack_enums)
  36.     #pragma options align=power
  37. #endif
  38.  
  39. #endif  /* OS_MACINTOSH */
  40.  
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif    /* __cplusplus */
  44.  
  45. /******************************************************************************
  46.  **                                                                             **
  47.  **                            Enum Definitions                                 **
  48.  **                                                                             **
  49.  *****************************************************************************/
  50.  
  51. typedef enum TQ3AttenuationType {
  52.     kQ3AttenuationTypeNone,
  53.     kQ3AttenuationTypeInverseDistance,
  54.     kQ3AttenuationTypeInverseDistanceSquared
  55. } TQ3AttenuationType;
  56.  
  57.  
  58. typedef enum TQ3FallOffType {
  59.     kQ3FallOffTypeNone,
  60.     kQ3FallOffTypeLinear,
  61.     kQ3FallOffTypeExponential,
  62.     kQ3FallOffTypeCosine
  63. } TQ3FallOffType;
  64.  
  65.  
  66. /******************************************************************************
  67.  **                                                                             **
  68.  **                            Data Structure Definitions                         **
  69.  **                                                                             **
  70.  *****************************************************************************/
  71.  
  72. typedef struct TQ3LightData {
  73.     TQ3Boolean            isOn;
  74.     float                brightness;
  75.     TQ3ColorRGB            color;
  76. } TQ3LightData;
  77.  
  78. typedef struct TQ3DirectionalLightData {
  79.     TQ3LightData        lightData;
  80.     TQ3Boolean            castsShadows;
  81.     TQ3Vector3D            direction;
  82. } TQ3DirectionalLightData;
  83.  
  84. typedef struct TQ3PointLightData {
  85.     TQ3LightData        lightData;
  86.     TQ3Boolean            castsShadows;
  87.     TQ3AttenuationType    attenuation;
  88.     TQ3Point3D            location;
  89. } TQ3PointLightData;
  90.  
  91. typedef struct TQ3SpotLightData {
  92.     TQ3LightData        lightData;
  93.     TQ3Boolean            castsShadows;
  94.     TQ3AttenuationType    attenuation;
  95.     TQ3Point3D            location;
  96.     TQ3Vector3D            direction;
  97.     float                hotAngle;
  98.     float                outerAngle;
  99.     TQ3FallOffType        fallOff;
  100. } TQ3SpotLightData;
  101.  
  102.  
  103. /******************************************************************************
  104.  **                                                                             **
  105.  **                    Light routines (apply to all TQ3LightObjects)             **
  106.  **                                                                             **
  107.  *****************************************************************************/
  108.  
  109. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Light_GetType(
  110.     TQ3LightObject        light);
  111.  
  112. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_GetState(
  113.     TQ3LightObject        light,
  114.     TQ3Boolean            *isOn);
  115.                 
  116. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_GetBrightness(
  117.     TQ3LightObject        light,
  118.     float                *brightness);
  119.     
  120. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_GetColor(
  121.     TQ3LightObject        light,
  122.     TQ3ColorRGB            *color);
  123.     
  124. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_SetState(
  125.     TQ3LightObject        light,
  126.     TQ3Boolean            isOn);
  127.                 
  128. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_SetBrightness(
  129.     TQ3LightObject        light,
  130.     float                brightness);
  131.     
  132. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_SetColor(
  133.     TQ3LightObject        light,
  134.     const TQ3ColorRGB    *color);
  135.  
  136. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_GetData(
  137.     TQ3LightObject        light,
  138.     TQ3LightData        *lightData);
  139.  
  140. QD3D_EXPORT TQ3Status QD3D_CALL Q3Light_SetData(
  141.     TQ3LightObject        light,
  142.     const TQ3LightData    *lightData);
  143.     
  144.  
  145. /******************************************************************************
  146.  **                                                                             **
  147.  **                            Specific Light Routines                               **
  148.  **                                                                             **
  149.  *****************************************************************************/
  150.  
  151. /******************************************************************************
  152.  **                                                                             **
  153.  **                            Ambient Light                                       **
  154.  **                                                                             **
  155.  *****************************************************************************/
  156.  
  157. QD3D_EXPORT TQ3LightObject QD3D_CALL Q3AmbientLight_New(
  158.     const TQ3LightData                *lightData);
  159.  
  160. QD3D_EXPORT TQ3Status QD3D_CALL Q3AmbientLight_GetData(
  161.     TQ3LightObject                    light,
  162.     TQ3LightData                    *lightData);
  163.  
  164. QD3D_EXPORT TQ3Status QD3D_CALL Q3AmbientLight_SetData(
  165.     TQ3LightObject                    light,
  166.     const TQ3LightData                *lightData);
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **                        Directional Light                                     **
  172.  **                                                                             **
  173.  *****************************************************************************/
  174.  
  175. QD3D_EXPORT TQ3LightObject QD3D_CALL Q3DirectionalLight_New(
  176.     const TQ3DirectionalLightData    *directionalLightData);
  177.     
  178. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_GetCastShadowsState(
  179.     TQ3LightObject                    light,
  180.     TQ3Boolean                        *castsShadows);
  181.     
  182. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_GetDirection(
  183.     TQ3LightObject                    light,
  184.     TQ3Vector3D                        *direction);
  185.     
  186. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_SetCastShadowsState(
  187.     TQ3LightObject                    light,
  188.     TQ3Boolean                        castsShadows);
  189.     
  190. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_SetDirection(
  191.     TQ3LightObject                    light,
  192.     const TQ3Vector3D                *direction);
  193.  
  194. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_GetData(
  195.     TQ3LightObject                    light,
  196.     TQ3DirectionalLightData            *directionalLightData);
  197.  
  198. QD3D_EXPORT TQ3Status QD3D_CALL Q3DirectionalLight_SetData(
  199.     TQ3LightObject                    light,
  200.     const TQ3DirectionalLightData    *directionalLightData);
  201.  
  202.  
  203. /******************************************************************************
  204.  **                                                                             **
  205.  **                        Point Light                                              **
  206.  **                                                                             **
  207.  *****************************************************************************/
  208.  
  209. QD3D_EXPORT TQ3LightObject QD3D_CALL Q3PointLight_New(
  210.     const TQ3PointLightData            *pointLightData);
  211.  
  212. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_GetCastShadowsState(
  213.     TQ3LightObject                    light,
  214.     TQ3Boolean                        *castsShadows);
  215.     
  216. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_GetAttenuation(
  217.     TQ3LightObject                    light,
  218.     TQ3AttenuationType                *attenuation);
  219.     
  220. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_GetLocation(
  221.     TQ3LightObject                    light,
  222.     TQ3Point3D                        *location);
  223.  
  224. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_GetData(
  225.     TQ3LightObject                    light,
  226.     TQ3PointLightData                *pointLightData);
  227.     
  228. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_SetCastShadowsState(
  229.     TQ3LightObject                    light,
  230.     TQ3Boolean                        castsShadows);
  231.     
  232. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_SetAttenuation(
  233.     TQ3LightObject                    light,
  234.     TQ3AttenuationType                attenuation);
  235.     
  236. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_SetLocation(
  237.     TQ3LightObject                    light,
  238.     const TQ3Point3D                *location);
  239.  
  240. QD3D_EXPORT TQ3Status QD3D_CALL Q3PointLight_SetData(
  241.     TQ3LightObject                    light,
  242.     const TQ3PointLightData            *pointLightData);
  243.     
  244.  
  245. /******************************************************************************
  246.  **                                                                             **
  247.  **                        Spot Light                                              **
  248.  **                                                                             **
  249.  *****************************************************************************/
  250.  
  251. QD3D_EXPORT TQ3LightObject QD3D_CALL Q3SpotLight_New(
  252.     const TQ3SpotLightData            *spotLightData);
  253.  
  254. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetCastShadowsState(
  255.     TQ3LightObject                    light,
  256.     TQ3Boolean                        *castsShadows);
  257.     
  258. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetAttenuation(
  259.     TQ3LightObject                    light,
  260.     TQ3AttenuationType                *attenuation);
  261.     
  262. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetLocation(
  263.     TQ3LightObject                    light,
  264.     TQ3Point3D                        *location);
  265.         
  266. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetDirection(
  267.     TQ3LightObject                    light,
  268.     TQ3Vector3D                        *direction);
  269.         
  270. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetHotAngle(
  271.     TQ3LightObject                    light,
  272.     float                            *hotAngle);
  273.         
  274. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetOuterAngle(
  275.     TQ3LightObject                    light,
  276.     float                            *outerAngle);
  277.         
  278. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetFallOff(
  279.     TQ3LightObject                    light,
  280.     TQ3FallOffType                    *fallOff);
  281.  
  282. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_GetData(
  283.     TQ3LightObject                    light,
  284.     TQ3SpotLightData                *spotLightData);
  285.  
  286. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetCastShadowsState(
  287.     TQ3LightObject                    light,
  288.     TQ3Boolean                        castsShadows);
  289.     
  290. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetAttenuation(
  291.     TQ3LightObject                    light,
  292.     TQ3AttenuationType                attenuation);
  293.     
  294. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetLocation(
  295.     TQ3LightObject                    light,
  296.     const TQ3Point3D                *location);
  297.  
  298. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetDirection(
  299.     TQ3LightObject                    light,
  300.     const TQ3Vector3D                *direction);
  301.  
  302. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetHotAngle(
  303.     TQ3LightObject                    light,
  304.     float                            hotAngle);
  305.         
  306. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetOuterAngle(
  307.     TQ3LightObject                    light,
  308.     float                            outerAngle);
  309.         
  310. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetFallOff(
  311.     TQ3LightObject                    light,
  312.     TQ3FallOffType                    fallOff);
  313.  
  314. QD3D_EXPORT TQ3Status QD3D_CALL Q3SpotLight_SetData(
  315.     TQ3LightObject                    light,
  316.     const TQ3SpotLightData            *spotLightData);
  317.  
  318.  
  319. #ifdef __cplusplus
  320. }
  321. #endif    /* __cplusplus */
  322.  
  323. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  324.  
  325. #if defined(__xlc__) || defined(__XLC121__)
  326.     #pragma options enum=reset
  327.     #pragma options align=reset
  328. #elif defined(__MWERKS__)
  329.     #pragma enumsalwaysint reset
  330.     #pragma options align=reset
  331. #elif defined(__MRC__) || defined(__SC__)
  332.     #if PRAGMA_ENUM_RESET_QD3DLIGHT
  333.         #pragma options(pack_enums)
  334.         #undef PRAGMA_ENUM_RESET_QD3DLIGHT
  335.     #endif
  336.     #pragma options align=reset
  337. #endif
  338.  
  339. #endif  /* OS_MACINTOSH */
  340.  
  341. #endif  /*  QD3DLight_h  */
  342.